home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Magazine / Morphos / GCC / ppc-amigaos / include / powerup / ppclib / tasks.i < prev    next >
Text File  |  2000-02-28  |  13KB  |  533 lines

  1.     IFND POWERUP_PPCLIB_TASKS_I
  2. POWERUP_PPCLIB_TASKS_I    SET    1
  3.  
  4. ;/**************************************************
  5. ; *
  6. ; *
  7. ; *              PPCCreateTask() Tags
  8. ; *
  9. ; *
  10. ; **************************************************/
  11.  
  12. PPCTASKTAG_DUMMY    =(TAG_USER+$20000)
  13.  
  14. ;/* Program Counter Start of the Task; */
  15. PPCTASKTAG_ELFOBJECT    =(PPCTASKTAG_DUMMY+$1)
  16.  
  17. ;/* Name of the new Task.; */
  18. PPCTASKTAG_NAME        =(PPCTASKTAG_DUMMY+$2)
  19.  
  20. ;/* First Argument..gpr3; */
  21. PPCTASKTAG_ARG1        =(PPCTASKTAG_DUMMY+$3)
  22.  
  23. ;/* First Argument..gpr4; */
  24. PPCTASKTAG_ARG2        =(PPCTASKTAG_DUMMY+$4)
  25.  
  26. ;/* First Argument..gpr5; */
  27. PPCTASKTAG_ARG3        =(PPCTASKTAG_DUMMY+$5)
  28.  
  29. ;/* First Argument..gpr6; */
  30. PPCTASKTAG_ARG4        =(PPCTASKTAG_DUMMY+$6)
  31.  
  32. ;/* First Argument..gpr7; */
  33. PPCTASKTAG_ARG5        =(PPCTASKTAG_DUMMY+$7)
  34.  
  35. ;/* First Argument..gpr8; */
  36. PPCTASKTAG_ARG6        =(PPCTASKTAG_DUMMY+$8)
  37.  
  38. ;/* First Argument..gpr9; */
  39. PPCTASKTAG_ARG7        =(PPCTASKTAG_DUMMY+$9)
  40.  
  41. ;/* First Argument..gpr10; */
  42. PPCTASKTAG_ARG8        =(PPCTASKTAG_DUMMY+$a)
  43.  
  44. ;/* Default=TRUE means that the cacheflush is handled automaticly
  45. ; * You need cacheflushs when you use OS functions to share data.
  46. ; * If you know it better than the stupid cacheflush routine you
  47. ; * can handle that yourself and optimize your routines.
  48. ; */
  49.  
  50. PPCTASKTAG_CACHEFLUSH    =(PPCTASKTAG_DUMMY+$b)
  51.  
  52. ;/* Ptr to an ULONG Errorfield where a better error description
  53. ; * can be stored.
  54. ; */
  55.  
  56. PPCTASKTAG_ERROR    =(PPCTASKTAG_DUMMY+$c)
  57.  
  58. ;/* PPC Stacksize...Default 8192;
  59. ; * Supported by PowerUP's PPCGetTaskAttr() (V45)
  60. ; */
  61. PPCTASKTAG_STACKSIZE    =(PPCTASKTAG_DUMMY+$d)
  62.  
  63. ;/* Task Priority..Default 0; */
  64. PPCTASKTAG_PRIORITY    =(PPCTASKTAG_DUMMY+$e)
  65.  
  66. ;/* Input Handle..Default Open("Nil:")
  67. ; * The handle is closed when the PPC task completes
  68. ; */
  69. PPCTASKTAG_INPUTHANDLE    =(PPCTASKTAG_DUMMY+$f)
  70.  
  71. ;/* Output Handle..Default Open("Nil:")
  72. ; * The handle is closed when the PPC task completes
  73. ; */
  74. PPCTASKTAG_OUTPUTHANDLE    =(PPCTASKTAG_DUMMY+$10)
  75.  
  76. ;/* Error Handle..Default Open("Nil:")
  77. ; * The handle is closed when the PPC task completes
  78. ; */
  79. PPCTASKTAG_ERRORHANDLE    =(PPCTASKTAG_DUMMY+$11)
  80.  
  81. ;/*
  82. ; * When you set this Tag the Task is stopped
  83. ; * before the first instruction is executed
  84. ; * Only useful for debuggers
  85. ; */
  86. PPCTASKTAG_STOPTASK    =(PPCTASKTAG_DUMMY+$12)
  87.  
  88. ;/* ExceptionHook
  89. ; * The M68k Hook is called when a PPC TaskObject gets an
  90. ; * exception which can be processor or software(Kernel Msg)
  91. ; * related.
  92. ; * That`s the way the ppc.library calls the Hook:
  93. ; *
  94. ; * BOOL CallHookPkt(hook,TaskObject,ExceptionMsg);
  95. ; *
  96. ; * The Hook Function is NOT allowed to call PPCLibBase
  97. ; * functions to avoid deadlocks.
  98. ; * And after the Hook function returns the ExceptionMsg
  99. ; * contents IS NOT valid anymore.
  100. ; * So you should copy the ExceptionMsg contents to a private
  101. ; * buffer and then signal your debugger control task about
  102. ; * the event.
  103. ; * The Hook return BOOL should tell the ppc.library if all
  104. ; * worked fine.
  105. ; */
  106.  
  107. PPCTASKTAG_EXCEPTIONHOOK    =(PPCTASKTAG_DUMMY+$13)
  108.  
  109. ;/* If you want that the PPCPort gets a MsgPort you can tell
  110. ; * PPCCreateTask by a TRUE that you want one.
  111. ; * I made this optional because it may cause an initial speed
  112. ; * loss if you only need a ppc task for a quick run job where
  113. ; * the init latency may be a serious issue.
  114. ; * Supported by PowerUP's PPCGetTaskAttr()
  115. ; */
  116. PPCTASKTAG_MSGPORT        =(PPCTASKTAG_DUMMY+$14)
  117.  
  118. ;/* If you wanna provide the ppc a startup msg. This msg will
  119. ; * be replied by the ppc.library after the PPC Task ends so
  120. ; * you can use this to abitrate your PPCUnloadObject()
  121. ; * Supported by PowerUP's PPCGetTaskAttr()
  122. ; */
  123. PPCTASKTAG_STARTUP_MSG        =(PPCTASKTAG_DUMMY+$15)
  124. ;/* The Data field for the PPCMessage
  125. ; * Supported by PowerUP's PPCGetTaskAttr()
  126. ; */
  127. PPCTASKTAG_STARTUP_MSGDATA    =(PPCTASKTAG_DUMMY+$16)
  128. ;/* The Length field for the PPCMessage
  129. ; * Supported by PowerUP's PPCGetTaskAttr()
  130. ; */
  131. PPCTASKTAG_STARTUP_MSGLENGTH    =(PPCTASKTAG_DUMMY+$17)
  132. ;/* The MsgID field for the PPCMessage
  133. ; * Supported by PowerUP's PPCGetTaskAttr()
  134. ; */
  135. PPCTASKTAG_STARTUP_MSGID    =(PPCTASKTAG_DUMMY+$18)
  136. ;/* The flag to activate the CTRL-C;D;E;F gateway to
  137. ; * the PPC Task by PPCSendSignal();
  138. ; */
  139. PPCTASKTAG_BREAKSIGNAL        =(PPCTASKTAG_DUMMY+$19)
  140.  
  141. ;/* The CPU number the task should start on.
  142. ; * This is only a hint and no gurantee.
  143. ; */
  144. PPCTASKTAG_CPUHINT        =(PPCTASKTAG_DUMMY+$1a)
  145.  
  146. ;/* Ptr to ixemul UserData
  147. ; * ONLY supported by PowerUP's PPCGetTaskAttr(),PPCSetTaskAttr()
  148. ; */
  149. PPCTASKTAG_EXTUSERDATA        =(PPCTASKTAG_DUMMY+$1b)
  150.  
  151. ;/* Run Task Synchron Flag which means that the PPCCreateTask
  152. ; * doesn`t return until the task completes and the return
  153. ; * value is not the TaskObject but the Task`s return value.
  154. ; * To check if the task runned correctly check out the
  155. ; * PPCTASKTAG_ERROR fieldptr.
  156. ; * With this Tag you can do the same what the old RunTaskObject
  157. ; * does which interface is a bit limited(compatibility to the
  158. ; * first ppc.library version)
  159. ; */
  160.  
  161. PPCTASKTAG_WAITFINISH    =(PPCTASKTAG_DUMMY+$31)
  162.  
  163. ;/* 
  164. ; * PPCTAGTAG_ERROR types
  165. ; */
  166.  
  167. ERROR_OK        =0
  168. ERROR_MEMORY        =1
  169. ERROR_NOPC        =2
  170. ERROR_CREATEMSGINTASK    =3
  171. ERROR_INPUTHANDLE    =4
  172. ERROR_OUTPUTHANDLE    =5
  173. ERROR_ERRORHANDLE    =6
  174.  
  175.  
  176.  
  177.  
  178. ;/**************************************************
  179. ; *
  180. ; *
  181. ; *             PPCGetTaskInfo() Tags
  182. ; *
  183. ; *
  184. ; **************************************************/
  185.  
  186. ;/*
  187. ; * V45 adds the ti_Data data Set/Get passing if it`s possible
  188. ; */
  189.  
  190. PPCTASKINFOTAG_DUMMY        =(TAG_USER+$21000)
  191. PPCTASKINFOTAG_NAME        =(PPCTASKINFOTAG_DUMMY+$1)
  192. PPCTASKINFOTAG_PRIORITY        =(PPCTASKINFOTAG_DUMMY+$2)
  193. PPCTASKINFOTAG_CACHEFLUSH    =(PPCTASKINFOTAG_DUMMY+$3)
  194. PPCTASKINFOTAG_STACKSIZE    =(PPCTASKINFOTAG_DUMMY+$4)
  195. PPCTASKINFOTAG_STATE        =(PPCTASKINFOTAG_DUMMY+$5)
  196. PPCTASKINFOTAG_TASK        =(PPCTASKINFOTAG_DUMMY+$6)
  197.  
  198. ;/* This means the HOOK function is called for every Task; */
  199. PPCTASKINFOTAG_ALLTASK        =(PPCTASKINFOTAG_DUMMY+$7)
  200.  
  201. ;/* Hook function which is called for a task so you can ask special fields
  202. ; * you may want to use.
  203. ; * Msg Parameter is NULL for now.
  204. ; * Object Parameter is the TaskObject
  205. ; *
  206. ; *    HookFunc(Hook, TaskObject, NULL)
  207. ; */
  208. PPCTASKINFOTAG_HOOK        =(PPCTASKINFOTAG_DUMMY+$8)
  209.  
  210. PPCTASKINFOTAG_SIGALLOC        =(PPCTASKINFOTAG_DUMMY+$9)
  211. PPCTASKINFOTAG_SIGWAIT        =(PPCTASKINFOTAG_DUMMY+$a)
  212. PPCTASKINFOTAG_SIGRECVD        =(PPCTASKINFOTAG_DUMMY+$b)
  213. PPCTASKINFOTAG_USEDSTACKSIZE    =(PPCTASKINFOTAG_DUMMY+$c)
  214. PPCTASKINFOTAG_INPUTHANDLE    =(PPCTASKINFOTAG_DUMMY+$d)
  215. PPCTASKINFOTAG_OUTPUTHANDLE    =(PPCTASKINFOTAG_DUMMY+$e)
  216. PPCTASKINFOTAG_ERRORHANDLE    =(PPCTASKINFOTAG_DUMMY+$f)
  217.  
  218. ;/* Return the ElfObject of a Task
  219. ; * (Get)
  220. ; * (V45)
  221. ; */
  222.  
  223. PPCTASKINFOTAG_ELFOBJECT        =(PPCTASKINFOTAG_DUMMY+$10)
  224.  
  225. ;/* See equal PPCTASKTAG_EXCEPTIONHOOK
  226. ; * (V45)
  227. ; * (Set)
  228. ; */
  229.  
  230. PPCTASKINFOTAG_EXCEPTIONHOOK        =(PPCTASKINFOTAG_DUMMY+$11)
  231.  
  232. ;/* Tell the task to stop at the first instruction.
  233. ; * Only allowed to be used when you get a TaskHookMsg
  234. ; * with the MethodID PPCTASKHOOKMETHOD_CREATE.
  235. ; * It must not be called while a PPC Task runs.
  236. ; * (V45)
  237. ; * (Set)
  238. ; */
  239. PPCTASKINFOTAG_STOPTASK            =(PPCTASKINFOTAG_DUMMY+$12)
  240.  
  241.  
  242. ;/* See equal PPCTASKTAG_MSGPORT
  243. ; * (V45)
  244. ; */
  245. PPCTASKINFOTAG_MSGPORT            =(PPCTASKINFOTAG_DUMMY+$13)
  246.  
  247. ;/* See equal PPCTASKTAG_STARTUP_MSG
  248. ; * (V45)
  249. ; */
  250. PPCTASKINFOTAG_STARTUP_MSG        =(PPCTASKINFOTAG_DUMMY+$14)
  251.  
  252. ;/* See equal PPCTASKTAG_STARTUP_MSGDATA
  253. ; * (V45)
  254. ; */
  255. PPCTASKINFOTAG_STARTUP_MSGDATA        =(PPCTASKINFOTAG_DUMMY+$15)
  256.  
  257. ;/* See equal PPCTASKTAG_STARTUP_MSGLENGTH
  258. ; * (V45)
  259. ; */
  260. PPCTASKINFOTAG_STARTUP_MSGLENGTH    =(PPCTASKINFOTAG_DUMMY+$16)
  261.  
  262. ;/* See equal PPCTASKTAG_STARTUP_MSGID
  263. ; * (V45)
  264. ; */
  265. PPCTASKINFOTAG_STARTUP_MSGID        =(PPCTASKINFOTAG_DUMMY+$17)
  266.  
  267. ;/*
  268. ; * All Register Tags only accept Ptrs at ti_Data so I don`t have to
  269. ; * change the API when there`s a 64Bit PPC some time.
  270. ; */
  271.  
  272. ;/* SRR0=PC;
  273. ; * Get/Set through ti_Data or PPCTASKINFOTAG_VALUEPTR
  274. ; * (Get/Set)
  275. ; */
  276. PPCTASKINFOTAG_PC        =(PPCTASKINFOTAG_DUMMY+$20)
  277. ;/* SRR1=MSR;
  278. ; * Get/Set through ti_Data or PPCTASKINFOTAG_VALUEPTR
  279. ; * (Get/Set)
  280. ; */
  281. PPCTASKINFOTAG_MSR        =(PPCTASKINFOTAG_DUMMY+$21)
  282.  
  283. ;/* 32bit value in function Result;
  284. ; * Get/Set through ti_Data
  285. ; * (Get/Set)
  286. ; */
  287. PPCTASKINFOTAG_CR        =(PPCTASKINFOTAG_DUMMY+$22)
  288.  
  289. ;/* 32bit value in function Result;
  290. ; * Get/Set through ti_Data
  291. ; * (Get/Set)
  292. ; */
  293. PPCTASKINFOTAG_XER        =(PPCTASKINFOTAG_DUMMY+$23)
  294.  
  295. ;/* Result by PPCTASKINFOTAG_VALUEPTR;
  296. ; * Get/Set through ti_Data or PPCTASKINFOTAG_VALUEPTR
  297. ; * (Get/Set)
  298. ; */
  299. PPCTASKINFOTAG_LR        =(PPCTASKINFOTAG_DUMMY+$24)
  300.  
  301. ;/* Result by PPCTASKINFOTAG_VALUEPTR;
  302. ; * Get/Set through ti_Data or PPCTASKINFOTAG_VALUEPTR
  303. ; * (Get/Set)
  304. ; */
  305.  
  306. PPCTASKINFOTAG_CTR        =(PPCTASKINFOTAG_DUMMY+$25)
  307.  
  308. ;/* Result by PPCTASKINFOTAG_VALUEPTR;
  309. ; * Get/Set through ti_Data or PPCTASKINFOTAG_VALUEPTR
  310. ; * (Get/Set)
  311. ; */
  312. PPCTASKINFOTAG_FPSCR        =(PPCTASKINFOTAG_DUMMY+$26)
  313.  
  314. ;/* ti_Data=Register Number
  315. ; * Get/Set through PPCTASKINFOTAG_VALUEPTR
  316. ; * (Get/Set)
  317. ; */
  318. PPCTASKINFOTAG_GPR        =(PPCTASKINFOTAG_DUMMY+$30)
  319.  
  320. ;/* ti_Data=Register Number
  321. ; * Get/Set through PPCTASKINFOTAG_VALUEPTR
  322. ; * (Get/Set)
  323. ; */
  324. PPCTASKINFOTAG_FPR        =(PPCTASKINFOTAG_DUMMY+$31)
  325.  
  326. ;/* Address where to read/write the register value from.
  327. ; * I use a ptr to be size indepent with the registers
  328. ; */
  329. PPCTASKINFOTAG_VALUEPTR        =(PPCTASKINFOTAG_DUMMY+$32)
  330.  
  331.  
  332. ;/* With PPCTASKINFOTAG_WAITFINISHTASK
  333. ; * it returns the parent process in which you created
  334. ; * a synchron PPC Task. Synchron PPC Task`s are created
  335. ; * with the PPCTASKTAG_WAITINFISH,TRUE or outdated a
  336. ; * PPCRunObject.
  337. ; * The reason for this function is to find the shell
  338. ; * task easily and check for a CTRL-C for example.
  339. ; * (Get)
  340. ; * (V45)
  341. ; */
  342. PPCTASKINFOTAG_WAITFINISHTASK    =(PPCTASKTAG_DUMMY+$33)
  343.  
  344.  
  345.  
  346.  
  347. ;/**************************************************
  348. ; *
  349. ; *
  350. ; *           TaskObject ExceptionHook
  351. ; *
  352. ; *
  353. ; **************************************************/
  354.  
  355.  
  356.     STRUCTURE    ExceptionMsg,0
  357.     ULONG            Version;
  358.     ULONG            Type;
  359.     STRUCT            GPR,32*4;
  360.     STRUCT            FPR,32*8;
  361.     STRUCT            SR,16*4;
  362.     ULONG            CR;
  363.     DOUBLE            FPSCR;
  364.     ULONG            XER;
  365.     ULONG            LR;
  366.     ULONG            CTR;
  367.     ULONG            PVR;
  368.     ULONG            IBAT0U;
  369.     ULONG            IBAT0L;
  370.     ULONG            IBAT1U;
  371.     ULONG            IBAT1L;
  372.     ULONG            IBAT2U;
  373.     ULONG            IBAT2L;
  374.     ULONG            IBAT3U;
  375.     ULONG            IBAT3L;
  376.  
  377.     ULONG            DBAT0U;
  378.     ULONG            DBAT0L;
  379.     ULONG            DBAT1U;
  380.     ULONG            DBAT1L;
  381.     ULONG            DBAT2U;
  382.     ULONG            DBAT2L;
  383.     ULONG            DBAT3U;
  384.     ULONG            DBAT3L;
  385.  
  386.     ULONG            SDR1;
  387.     ULONG            ASR;
  388.  
  389.     ULONG            DAR;
  390.     ULONG            DSISR;
  391.     ULONG            SRR0;
  392.     ULONG            SRR1;
  393.  
  394.     ULONG            SPRG0;
  395.     ULONG            SPRG1;
  396.     ULONG            SPRG2;
  397.     ULONG            SPRG3;
  398.  
  399.     ULONG            TBL;
  400.     ULONG            TBU;
  401.     ULONG            DEC;
  402.     ULONG            DABR;
  403.  
  404.     ;/* 603 special registers; */
  405.  
  406.     ULONG            DMISS;
  407.     ULONG            DCMP;
  408.     ULONG            HASH1;
  409.     ULONG            HASH2;
  410.     ULONG            IMISS;
  411.     ULONG            ICMP;
  412.     ULONG            RPA;
  413.  
  414.     ;/* 604e special registers; */
  415.  
  416.     ;/* Version 0 ends here; */
  417.  
  418.     ULONG            MSR;
  419.  
  420.     ;/* Version 1 ends here */
  421.  
  422.     ;/* Size depends on Version; */
  423.  
  424.  
  425. ;/* Current supported Version
  426. ; */
  427.  
  428. EXCEPTIONMSG_VERSION    =    1
  429.  
  430. ;/*
  431. ; * Current supported Types
  432. ; */
  433.  
  434. ;/*
  435. ; * These are the processor exceptions
  436. ; */
  437.  
  438. EXCEPTION_UNKNOWN        =0    ;/* Won`t happen; */
  439. EXCEPTION_RESET            =1    ;/* Won`t happen; */
  440. EXCEPTION_MACHINECHECK        =2    ;/* Won`t happen; */
  441. EXCEPTION_DATAACCESS        =3
  442. EXCEPTION_INSTRUCTIONACCESS    =4
  443. EXCEPTION_EXTERNALINTERRUPT    =5    ;/* Won`t happen; */
  444. EXCEPTION_ALIGNMENT        =6
  445. EXCEPTION_PROGRAM        =7
  446. EXCEPTION_FPUUNAVAILABLE    =8
  447. EXCEPTION_DECREMENTER        =9
  448. EXCEPTION_INTERFACEERROR    =10
  449. EXCEPTION_RESERVED_B        =11
  450. EXCEPTION_SYSTEMCALL        =12
  451. EXCEPTION_TRACE            =13
  452. EXCEPTION_FPUASSIST        =14
  453. EXCEPTION_RESERVED_F        =15
  454. EXCEPTION_IMISS            =16
  455. EXCEPTION_DLOADMISS        =17
  456. EXCEPTION_DSTOREMISS        =18
  457. EXCEPTION_IADDRESSBREAK        =19
  458. EXCEPTION_SYSTEMMANAGEMENTINT    =20
  459.  
  460.  
  461. ;/*
  462. ; * These are the kernel exceptions
  463. ; * to signal certain events
  464. ; */
  465.  
  466. EXCEPTION_MSG            =$80000000
  467.  
  468. ;/*
  469. ; * You receive this exception type
  470. ; * when the Kernel could stop a Task
  471. ; * successfully after a Stop or Trace
  472. ; * operation.
  473. ; * Look at PPCTASKTAG_STOPTASK for example
  474. ; */
  475.  
  476. EXCEPTION_STOPTASK        =(EXCEPTION_MSG+$0)
  477.  
  478. ;/*
  479. ; * You receive this exception type
  480. ; * when the task completes.
  481. ; * In this case the ONLY valid fields in the
  482. ; * ExceptionMsg are the Version field and the
  483. ; * the Message type.
  484. ; */
  485.  
  486. EXCEPTION_FINISHTASK        =(EXCEPTION_MSG+$1)
  487.  
  488.  
  489. ;/**************************************************
  490. ; *
  491. ; *
  492. ; *              PPCStartTask() Tags
  493. ; *
  494. ; *
  495. ; **************************************************/
  496.  
  497. PPCTASKSTARTTAG_DUMMY        =(TAG_USER+$22000)
  498.  
  499. ;/* Just run a Task again
  500. ; * ti_Data=BOOL
  501. ; */
  502. PPCTASKSTARTTAG_RUN        =(PPCTASKSTARTTAG_DUMMY+$0)
  503.  
  504. ;/* Single Step the next instruction
  505. ; * ti_Data=BOOL
  506. ; */
  507. PPCTASKSTARTTAG_TRACE        =(PPCTASKSTARTTAG_DUMMY+$1)
  508.  
  509. ;/* Branch until a Trace instruction
  510. ; * Processor dependent
  511. ; * ti_Data=BOOL
  512. ; * NOT SUPPORTED YET
  513. ; */
  514. PPCTASKSTARTTAG_BRANCHTRACE    =(PPCTASKSTARTTAG_DUMMY+$2)
  515.  
  516. ;/* Run until Instruction hit
  517. ; * the Breakpoint Address
  518. ; * Processor dependent
  519. ; * ti_Data=BOOL
  520. ; * NOT SUPPORTED YET
  521. ; */
  522. PPCTASKSTARTTAG_IBREAK        =(PPCTASKSTARTTAG_DUMMY+$3)
  523.  
  524. ;/* Run until DataAccess hit
  525. ; * the Breakpoint Address
  526. ; * Processor dependent
  527. ; * ti_Data=BOOL
  528. ; * NOT SUPPORTED YET
  529. ; */
  530. PPCTASKSTARTTAG_DBREAK        =(PPCTASKSTARTTAG_DUMMY+$4)
  531.  
  532.     ENDC
  533.